define(function (require, exports) {
	var Backbone = require('backbone');
	var util = require('lm-util');
	var _ = require('_');
	lemon.Model = {};
	lemon.View = {};
	lemon.List = {};


	lemon.Model.Member = Backbone.Model.extend({
		url:'?g=Home&m=User&a=ajaxUserStatus'
	});
	lemon.View.TopMember = Backbone.View.extend({
		events:{
			'click .J_toggleOnline':'toggleOnline',
			'mouseover .J_userCard': 'toggleUserCardTip',
		},
		render : function () {
			console.log(this.model.toJSON());
			var html = util.toHtml($('#T_TopMember').html(), this.model.toJSON());
			$(this.el).html(html);
		},
		initialize : function() {
			_.bindAll(this, "render", 'toggleOnline', 'toggleUserCardTip');
			this.model = new lemon.Model.Member();
			this.model.on('change', this.render);
			this.model.fetch();
		},
		toggleOnline:function(){
			var self = this;
			$.get('?g=Home&m=User&a=ajaxToggleOnline', function(data){
				self.model.set(data);
			})
		},
		toggleUserCardTip:function(){
			$('.J_userCardTip').toggle();
		}
	});


});